package cn.edu.buaa.treehole.pojo;

import java.util.Date;
import java.util.Objects;

/*
 * @author Deng XinYu
 * */
public class PostInfo {
    private long pid;
    private String title;
    private String content;
    private String signature;
    private Date date;

    public PostInfo() { }

    public PostInfo(long pid, String title, String content, String signature, Date date) {
        this.pid = pid;
        this.title = title;
        this.content = content;
        this.signature = signature;
        this.date = date;
    }

    public long getPid() {
        return pid;
    }

    public void setPid(long pid) {
        this.pid = pid;
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public String getSignature() {
        return signature;
    }

    public void setSignature(String signature) {
        this.signature = signature;
    }

    public String getContent() {
        return content;
    }

    public void setContent(String content) {
        this.content = content;
    }

    public Date getDate() {
        return date;
    }

    public void setDate(Date date) {
        this.date = date;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        PostInfo postInfo = (PostInfo) o;
        return pid == postInfo.pid &&
                Objects.equals(title, postInfo.title) &&
                Objects.equals(content, postInfo.content) &&
                Objects.equals(signature, postInfo.signature) &&
                Objects.equals(date, postInfo.date);
    }

    @Override
    public int hashCode() {
        return Objects.hash(pid, title, content, signature, date);
    }

    @Override
    public String toString() {
        return "PostInfo{" +
                "pid=" + pid +
                ", title='" + title + '\'' +
                ", content='" + content + '\'' +
                ", signature='" + signature + '\'' +
                ", date=" + date +
                '}';
    }
}
